package testMatador;

import model.*;

public class TestMatadorspil {

	private Players players;
	
	public void run()
	{
		resetPlayers();
		
		/*
		 * --------------------------------
		 * ------------ TEST 1 ------------
		 * --------------------------------
		 * */
		
		System.out.println("TEST 1\n");
		
		/*
		 * ------------ TEST A1 ------------
		 * */
		
		// A1.1
		
		CustomArray<Boolean> expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(true);
		expectedBooleans.add(false);
		expectedBooleans.add(true);
		expectedBooleans.add(false);
		
		CustomArray<Field> expectedBuildable = new CustomArray<Field>();
		expectedBuildable.add(GameBoard.getField(10));
		
		CustomArray<Field> expectedSellable = new CustomArray<Field>();
		
		CustomArray<Field> expectedPawnable = new CustomArray<Field>();
		expectedPawnable.add(GameBoard.getField(10));
		
		CustomArray<Field> expectedUnPawnable = new CustomArray<Field>();
		
		testPossibilities(
				10, // startPosition
				0, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				1000, // playerSaldo
				1, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"A1.1"); // testName
		
		// A1.2
	
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(true);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		
		expectedSellable = new CustomArray<Field>();
		
		expectedPawnable = new CustomArray<Field>();
		expectedPawnable.add(GameBoard.getField(10));
		
		expectedUnPawnable = new CustomArray<Field>();
		
		testPossibilities(
				10, // startPosition
				0, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				999, // playerSaldo
				1, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"A1.2"); // testName

		
		
		/*
		 * ------------ TEST A2 ------------
		 * */
		
		// A2.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(true);
		expectedBooleans.add(true);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		expectedBuildable.add(GameBoard.getField(22));
		
		expectedSellable = new CustomArray<Field>();
		expectedSellable.add(GameBoard.getField(22));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(22));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(22));
		
		testPossibilities(
				22, // startPosition
				4, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				3000, // playerSaldo
				1, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"A2.1"); // testName
		
		// A1.2
	
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(true);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(22));
		
		expectedSellable = new CustomArray<Field>();
		expectedSellable.add(GameBoard.getField(22));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(22));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(22));
		
		testPossibilities(
				22, // startPosition
				4, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				999, // playerSaldo
				1, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"A2.2"); // testName

		
		
		/*
		 * ------------ TEST A3 ------------
		 * */
		
		// A3.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(true);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(15));
		
		expectedSellable = new CustomArray<Field>();
		expectedSellable.add(GameBoard.getField(15));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(15));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(15));
		
		testPossibilities(
				15, // startPosition
				5, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				3000, // playerSaldo
				1, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"A3.1"); // testName

		
		
		/*
		 * ------------ TEST A4 ------------
		 * */
		
		// A4.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(true);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(29));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(29));
		
		expectedPawnable = new CustomArray<Field>();
		expectedPawnable.add(GameBoard.getField(29));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(29));
		
		testPossibilities(
				29, // startPosition
				0, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				5000, // playerSaldo
				1, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"A4.1"); // testName

		
		
		/*
		 * ------------ TEST A5 ------------
		 * */
		
		// A5.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(true);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(26));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(26));
		
		expectedPawnable = new CustomArray<Field>();
		expectedPawnable.add(GameBoard.getField(26));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(26));
		
		testPossibilities(
				26, // startPosition
				0, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				5000, // playerSaldo
				1, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"A5.1"); // testName

		
		
		/*
		 * ------------ TEST A6 ------------
		 * */
		
		// A6.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(true);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(4));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(4));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(4));
		
		expectedUnPawnable = new CustomArray<Field>();
		expectedUnPawnable.add(GameBoard.getField(4));
		
		testPossibilities(
				4, // startPosition
				0, // numHouses1
				true, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				660, // playerSaldo
				1, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"A6.1"); // testName
		
		// A6.2
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(4));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(4));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(4));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(4));
		
		testPossibilities(
				4, // startPosition
				0, // numHouses1
				true, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				659, // playerSaldo
				1, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"A6.2"); // testName

		
		
		/*
		 * ------------ TEST A7 ------------
		 * */
		
		// A7.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(true);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(29));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(29));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(29));
		
		expectedUnPawnable = new CustomArray<Field>();
		expectedUnPawnable.add(GameBoard.getField(29));
		
		testPossibilities(
				29, // startPosition
				0, // numHouses1
				true, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				2200, // playerSaldo
				1, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"A7.1"); // testName
		
		// A7.2
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(29));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(29));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(29));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(29));
		
		testPossibilities(
				29, // startPosition
				0, // numHouses1
				true, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				2199, // playerSaldo
				1, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"A7.2"); // testName

		
		
		/*
		 * ------------ TEST A8 ------------
		 * */
		
		// A8.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(true);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(6));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(6));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(6));
		
		expectedUnPawnable = new CustomArray<Field>();
		expectedUnPawnable.add(GameBoard.getField(6));
		
		testPossibilities(
				6, // startPosition
				0, // numHouses1
				true, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				2200, // playerSaldo
				1, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"A8.1"); // testName
		
		// A8.2
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(6));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(6));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(6));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(6));
		
		testPossibilities(
				6, // startPosition
				0, // numHouses1
				true, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				2199, // playerSaldo
				1, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"A8.2"); // testName

		
		


		
		
		/*
		 * ------------ TEST B1 ------------
		 * */
		
		// B1.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(10));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(10));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(10));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(10));
		
		testPossibilities(
				10, // startPosition
				0, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				1000, // playerSaldo
				2, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"B1.1"); // testName

	
		
		/*
		 * ------------ TEST B2 ------------
		 * */
		
		// B2.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(22));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(22));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(22));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(22));
		
		testPossibilities(
				22, // startPosition
				4, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				3000, // playerSaldo
				2, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"B2.1"); // testName

		
		
		/*
		 * ------------ TEST B3 ------------
		 * */
		
		// B3.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(15));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(15));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(15));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(15));
		
		testPossibilities(
				15, // startPosition
				5, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				3000, // playerSaldo
				2, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"B3.1"); // testName

		
		
		/*
		 * ------------ TEST B4 ------------
		 * */
		
		// B4.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(29));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(29));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(29));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(29));
		
		testPossibilities(
				29, // startPosition
				0, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				5000, // playerSaldo
				2, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"B4.1"); // testName

		
		
		/*
		 * ------------ TEST B5 ------------
		 * */
		
		// B5.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(26));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(26));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(26));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(26));
		
		testPossibilities(
				26, // startPosition
				0, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				5000, // playerSaldo
				2, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"B5.1"); // testName

		
		
		/*
		 * ------------ TEST B6 ------------
		 * */
		
		// A6.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(4));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(4));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(4));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(4));
		
		testPossibilities(
				4, // startPosition
				0, // numHouses1
				true, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				660, // playerSaldo
				2, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"B6.1"); // testName

		
		
		/*
		 * ------------ TEST B7 ------------
		 * */
		
		// A7.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(29));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(29));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(29));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(29));
		
		testPossibilities(
				29, // startPosition
				0, // numHouses1
				true, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				2200, // playerSaldo
				2, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"B7.1"); // testName

		
		
		/*
		 * ------------ TEST B8 ------------
		 * */
		
		// B8.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(6));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(6));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(6));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(6));
		
		testPossibilities(
				6, // startPosition
				0, // numHouses1
				true, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				2200, // playerSaldo
				2, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"B8.1"); // testName

		
		


		
		
		/*
		 * ------------ TEST C1 ------------
		 * */
		
		// C1.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(33));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(33));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(33));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(33));
		
		testPossibilities(
				33, // startPosition
				0, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				6000, // playerSaldo
				0, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				true, // canBuyField
				"C1.1"); // testName
		
		// C1.2
	
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(33));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(33));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(33));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(33));
		
		testPossibilities(
				33, // startPosition
				0, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				5999, // playerSaldo
				0, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"C1.2"); // testName

		
		
		/*
		 * ------------ TEST C2 ------------
		 * */
		
		// C2.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(29));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(29));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(29));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(29));
		
		testPossibilities(
				29, // startPosition
				0, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				4000, // playerSaldo
				0, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				true, // canBuyField
				"C2.1"); // testName
		
		// C1.2
	
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(29));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(29));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(29));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(29));
		
		testPossibilities(
				6, // startPosition
				0, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				3999, // playerSaldo
				0, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"C2.2"); // testName

		
		
		/*
		 * ------------ TEST C3 ------------
		 * */
		
		// C3.1
		
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(6));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(6));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(6));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(6));
		
		testPossibilities(
				6, // startPosition
				0, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				4000, // playerSaldo
				0, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				true, // canBuyField
				"C3.1"); // testName
		
		// C3.2
	
		expectedBooleans = new CustomArray<Boolean>();
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		expectedBooleans.add(false);
		
		expectedBuildable = new CustomArray<Field>();
		//expectedBuildable.add(GameBoard.getField(6));
		
		expectedSellable = new CustomArray<Field>();
		//expectedSellable.add(GameBoard.getField(6));
		
		expectedPawnable = new CustomArray<Field>();
		//expectedPawnable.add(GameBoard.getField(6));
		
		expectedUnPawnable = new CustomArray<Field>();
		//expectedUnPawnable.add(GameBoard.getField(6));
		
		testPossibilities(
				6, // startPosition
				0, // numHouses1
				false, // pawn1
				0, // chanceNum
				-1, // secondFieldNum
				0, // numHouses2
				false, // pawn2
				3999, // playerSaldo
				0, // ownerNumber
				expectedBooleans, // expectedBooleans
				expectedBuildable, // expectedBuildable
				expectedSellable, // expectedSellable
				expectedPawnable, // expectedPawnable
				expectedUnPawnable, // expectedUnPawnable
				false, // canBuyField
				"C3.2"); // testName
		
		
		
		
		
		
		/*
		 * --------------------------------
		 * ------------ TEST 2 ------------
		 * --------------------------------
		 * */
		System.out.println("\n\n\nTEST 2\n");
		if (testGetOutOfJailCards())
			System.out.println("PASSED");
		else
			System.out.println("FAILED");
	}
	
	
	
	public boolean testPossibilities(
			int startPosition,
			int numHouses1,
			boolean pawn1,
			int chanceNum,
			int secondFieldNum,
			int numHouses2,
			boolean pawn2,
			int playerSaldo,
			int ownerNumber,
			CustomArray<Boolean> expectedBooleans,
			CustomArray<Field> expectedBuildable,
			CustomArray<Field> expectedSellable,
			CustomArray<Field> expectedPawnable,
			CustomArray<Field> expectedUnPawnable,
			boolean canBuyField,
			String testName)
	{
		// Initialize players
		resetPlayers();
		Player player = players.getPlayers()[0];
		Player owner = null;
		
		if(ownerNumber == 1)
		{
			owner = player;
		}
		else if(ownerNumber == 2)
		{
			owner = players.getPlayers()[1];
		}
		
		CustomArray<Boolean> booleanResults = new CustomArray<Boolean>();
		
		// Set players saldo
		player.setSaldo(playerSaldo);
		
		// Save fields and set owner, if ownable
		Field field1 = GameBoard.getField(startPosition);
		if(field1 instanceof Ownable)
		{
			if(ownerNumber != 0)
			{
				((Ownable)field1).setOwner(owner);
			}
			
		}
		
		Field field2 = null;
			
		if(secondFieldNum != -1)
		{
			field2 = GameBoard.getField(secondFieldNum);
			((Ownable)field2).setOwner(owner);
		}
		
		// Should fields be pawned?
		if(pawn1)
		{
			((Ownable)field1).pawn();
		}
		if(pawn2)
		{
			((Ownable)field2).pawn();
		}
		
		// Set houses, if streets
		if(field1 instanceof Street)
		{
			for(int i = 0; i < numHouses1; i++)
			{
				((Street) field1).buyHouse();
			}
		}
		if(field2 instanceof Street)
		{
			for(int i = 0; i < numHouses2; i++)
			{
				((Street) field2).buyHouse();
			}
		}

		// Place player on field1
		player.setStandOnField(startPosition);
		
		field1.landOnField(player, 5, 1);
		
		// Draw chance card, if field1 = chance
		if(field1 instanceof Chance)
		{
			GameBoard.cards[chanceNum].draw(player);
		}
		
		// May player continue?
		if(player.mayCarryOn())
		{
			// Can player buy field? And should player be able to buy field?
			if(canBuyField == canBuyField(field1, player) || canBuyField == canBuyField(field2, player))
			{
				// What are the player's possibilities?
				booleanResults.add(GameBoard.hasBuildableFields(player));
				booleanResults.add(GameBoard.hasFieldsWithSellableBuilding(player));
				booleanResults.add(GameBoard.hasPawnableFields(player));
				booleanResults.add(GameBoard.hasUnPawnableFields(player));
				
				// Is the possibilities the once we expected?
				if(sameFieldLists(booleanResults, expectedBooleans))
				{
					// Can the player use his possibilities on the expected fields?
					if(arrayConsistOf(expectedBuildable, GameBoard.getBuildableFields(player)))
					{
						if(arrayConsistOf(expectedSellable, GameBoard.getSellableBuildings(player)))
						{
							if(arrayConsistOf(expectedPawnable, GameBoard.getPawnableFields(player)))
							{
								if(arrayConsistOf(expectedUnPawnable, GameBoard.getUnPawnableFields(player)))
								{
									System.out.println(testName + ": PASSED");
									return true;
								}
							}
							
						}
					}
				}
			}
			System.out.println(testName + ": Failed");
			return false;
		}
		else
		{
			// If mayCarryOn == false, player has no possibilities
			booleanResults.add(false);
			booleanResults.add(false);
			booleanResults.add(false);
			booleanResults.add(false);
			
			if(booleanResults == expectedBooleans)
			{
				System.out.println(testName + ": PASSED");
				return true;
			}
			else
			{
				System.out.println(testName + ": FAILED");
				return false;
			}
			
			
		}
	}
	
	
	private boolean testGetOutOfJailCards()
	{
		boolean result = true;
		resetPlayers();
		
		Player player1 = players.getPlayers()[0];
		Player player2 = players.getPlayers()[1];
		Player player3 = players.getPlayers()[2];
		Player player4 = players.getPlayers()[3];
		
		// Set all cards to drawn except from the jail cards
		for (Card card: GameBoard.cards)
		{
			if(!(card instanceof GetOutOfJail))
			{
				card.setDrawn(true);
			}
		}
		
		// (The game starts from here)
		
		// Player one lands on chance field and draws jailcard nr 19
		player1.setStandOnField(8);
		GameBoard.cards[31].setDrawn(true);
		player1.receiveJailCard();
		
		// Player two lands on chance field and draws jailcard nr 20
		player2.setStandOnField(3);
		GameBoard.cards[32].setDrawn(true);
		player2.receiveJailCard();
		
		// All cards are now drawn.
		int cardsLeft;
		
		// Player 3 draws the 1st ToJailCard
		if(GameBoard.getCard(players.getPlayers()) instanceof ToJailCard)
		{
			player3.setInJail(true);
			/* Player 4 draws the 2nd ToJailCard
			(both is set to drawn, while we do not know which is already drawn)*/
			GameBoard.cards[31].setDrawn(true);
			GameBoard.cards[32].setDrawn(true);
			player4.setInJail(true);
			cardsLeft = 31;
		}
		else
		{
			// Player 4 draws the 1st ToJailCard
			GameBoard.cards[31].setDrawn(true);
			player4.setInJail(true);
			
			// All players "roll their dices" and move
			player1.setStandOnField(9);
			player2.setStandOnField(7);
			player3.setStandOnField(3);
			// Player 3 draws the 2nd ToJailCard
			GameBoard.cards[32].setDrawn(true);
			player3.setInJail(true);
			cardsLeft = 30;
		}
				
		// Is it possible for the players to draw a 3rd or 4th jailcard from the cardstack?
		for(int cardNo = 0; cardNo < cardsLeft; cardNo++)
		{
			// A player lands on a chance field and draws a card
			Card card = GameBoard.getCard(players.getPlayers());
			if(card instanceof GetOutOfJail)
			{
				result = false;
				break;
			}
		}
		
		return result;
	}
	
	
	private boolean arrayConsistOf(CustomArray<Field> Array, CustomArray<Field> fields)
 	{
 		/*
 		 * Presupposed that a list do not contain the same field more than once
 		 * */
 		boolean fieldInArray;
 		
 		// Lengths should be equal
 		if(Array.size() == fields.size())
 		{
	 		for(Field field: fields)
	 		{
	 			fieldInArray = false;
	 			for(Field arrayElement: Array)
	 			{
	 				if(field.getName() == arrayElement.getName())
	 				{
	 					fieldInArray = true;
	 				}
	 			}
	 			if(!fieldInArray)
	 			{
	 				return false;
	 			}
	 		}
	 		return true;
 		}
 		else
 		{
 			return false;
 		}
 	}
	
	
	private boolean sameFieldLists(CustomArray<Boolean> list1, CustomArray<Boolean> list2)
 	{
		for(int i = 0; i < 4; i++)
		{
			if(!(list1.get(i) == list2.get(i)))
				return false;
		}
		return true;
 	}
	
	private void resetPlayers()
	{
		players = new Players(4);
		players.addPlayer("Player1", 0, 1);
		players.addPlayer("Player2", 1, 2);
		players.addPlayer("Player3", 2, 3);
		players.addPlayer("Player4", 3, 4);
		
		GameBoard.Initialize(players.getPlayers());
	}
	
	public boolean canBuyField(Field field, Player player)
	{
		// If field is ownable
		if (field instanceof Ownable)
		{
			Ownable ownableField = (Ownable) field;
			
			// If the field is NOT already owned
			if (!ownableField.isOwned())
			{
				// If player has enough money to buy field
				if (player.getBalance() >= ownableField.getPrice())
				{
					return true;
				}
			}
		}
		return false;
	}
}
